Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit pass over telemetry docs #268

Merged
merged 3 commits into from
Jul 29, 2024
Merged

Conversation

ckreibich
Copy link
Member

@ckreibich ckreibich commented Jul 27, 2024

This mainly expands the framework's documentation to give a bit more context on Prometheus, and moves the description of how to get telemetry out of Zeek up, before we give examples of the framework's use (which I think matters more for developers).

I noticed a few discrepancies while updating the code examples:

  • The exposition format is now cleaner. Trailing fractional zeroes are pruned, and we don't include timestamps any more (which are optional in the exposition format's definition, and actually looks preferable to me)
  • There's a minor bug in the framework in that MetricOpts says the unit field is optional, but omitting it actually causes errors in the metrics registration functions (just search for unguarded access to $unitopts$unit). I think that fix can wait for the first point release, particularly since existing code will still set the unit.

This was a nice reminder that we'd catch such things earlier if we had a setup that automatically runs the documentation's code examples as btests, or some such.

The PR also updates the management framework side, though the changes here are much smaller.

This mainly updates the documentation to cover the new Telemetry framework more
fully, and remove references to prior functionality that are no longer correct.

It also moves up coverage of how to export telemetry, since that's arguably what
regular users will care about more than how to build out your own additional
telemetry. I left those examples mostly unchanged though, they're really great.
I did switch their port to 9090 since it's Prometheus's suggested default, and I
simplified the sample outputs because it has in fact changed -- we no longer
include timestamps in the exposition, and trailing fractional zeroes are now
truncated as well ("1.0000" -> "1").
@ckreibich ckreibich force-pushed the topic/christian/telemetry-editpass branch from 471a1d5 to e32484a Compare July 27, 2024 03:35
@timwoj
Copy link
Member

timwoj commented Jul 29, 2024

The exposition format is now cleaner. Trailing fractional zeroes are pruned, and we don't include timestamps any more (which are optional in the exposition format's definition, and actually looks preferable to me)

Interesting. I guess we must have output the trailing zeroes and the timestamp as part of the Broker output, and prometheus-cpp doesn't do that.

Copy link
Member

@timwoj timwoj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I had a couple of minor nits I'll fix during merge. I'll also cherry-pick this over into the 7.0 release branch.

Native Prometheus Export
------------------------

Every Zeek process, regardless of whether it's runnig long-term standalone or as
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Every Zeek process, regardless of whether it's runnig long-term standalone or as
Every Zeek process, regardless of whether it's running long-term standalone or as

<https://github.com/prometheus/docs/blob/main/content/docs/instrumenting/exposition_formats.md#text-format-example>`_.

The :zeek:see:`Telemetry::metrics_port` variable controls this behavior. Its
default of ``0/unknown`` won't expose the port; setting it to another TCP port
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default of ``0/unknown`` won't expose the port; setting it to another TCP port
default of ``0/unknown`` disables exposing the port; setting it to another TCP port

@timwoj timwoj merged commit 209d1c9 into master Jul 29, 2024
10 checks passed
@timwoj timwoj deleted the topic/christian/telemetry-editpass branch July 29, 2024 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants